package com.woniu.repaircenter.service.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniu.repaircenter.models.dto.RepairMaterialDTO;
import com.woniu.repaircenter.service.model.RepairMaterial;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * 维修材料表 Mapper 接口
 * </p>
 *
 * @author 吕雨泽
 * @since 2024年12月06日
 */
@Mapper
public interface RepairMaterialMapper extends BaseMapper<RepairMaterial> {
    Integer insertAll(@Param("repairMaterials") List<RepairMaterial> repairMaterials);

    @Update("update repair_material set count = #{countChange} where material_code = #{materialCode} and repair_num = #{repairNum}")
    Integer updateAll(@Param("materialCode") String materialCode, @Param("repairNum") String repairNum,@Param("countChange") Integer countChange);

    List<RepairMaterial> selectListRepair(@Param("materialCode") String materialCode);

    RepairMaterial selectRepairMaterial(@Param("materialCode") String materialCode, @Param("repairNum") String repairNum);

    List<RepairMaterialDTO> selectListRepairNum(@Param("repairNum") String repairNum);
}
